Skip to content

Add a canonical rustfmt config #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 13, 2025
Merged

Add a canonical rustfmt config #86

merged 4 commits into from
Mar 13, 2025

Conversation

PoignardAzur
Copy link
Contributor

No description provided.

Comment on lines 34 to 35
# Forces let else blocks to always be their own line(s)
single_line_let_else_max_width = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do decide to set this, I'd expect it to have the same value as single_line_if_else_max_width, I think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, they seem very similar and have identical default values.

use_field_init_shorthand = true

# Forces let else blocks to always be their own line(s)
single_line_let_else_max_width = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously this isn't used at all in Linebender yet. This is a reasonable value, but I'd lean more towards keeping the default without very good reason, for consistency with the rest of the ecosystem.

This is certainly more taste based than the other two options here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth I copy-pasted it from the xilem repo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Fair. I don't care that much either way.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah we approved it in xilem#305. What I said back then still applies for me: it's quite minor and so I don't personally care much either way.

I believe this was originally added by you @PoignardAzur. So if you still think it's worth having, then I'm fine with it and don't want to bikeshed it. However, if you're not arguing for its benefit, then I don't think we have anyone doing that and we should omit it by default as Daniel mentioned.

Copy link
Contributor Author

@PoignardAzur PoignardAzur Mar 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I dropped the ball on this for a while. I'll make a separate PR to add it with a better justification.

Copy link
Member

@xStrom xStrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properly standardizing this across repos has been a long time coming, thanks for getting the ball actually rolling.

PoignardAzur and others added 2 commits January 23, 2025 17:57
@DJMcNab
Copy link
Member

DJMcNab commented Mar 11, 2025

To get this out of its stalled state, I've removed the single_line_let_else_max_width line. We can always follow-up to add it back if needed.

@DJMcNab DJMcNab requested a review from xStrom March 11, 2025 14:13
@DJMcNab
Copy link
Member

DJMcNab commented Mar 13, 2025

I've not handled the imports ordering stuff; we can easily do that as a follow-up, especially since it's still unstable.

@DJMcNab DJMcNab merged commit b3dbbf7 into main Mar 13, 2025
2 checks passed
@DJMcNab DJMcNab deleted the rustfmt_file branch March 13, 2025 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants